const base_url="http://127.0.0.1:9888"
const postRequset=(url,data)=>{
    return fetch(`${base_url}${url}`,{
        method:"post",
        headers:{
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(data)
    })
}


const getRequset=(url,param)=>{
    if (param != undefined){

    }
    return fetch(`${base_url}${url}`,{
        method:"get",
        headers:{
            'Content-Type': 'application/json'
        }
    })
}

const uploadRequest=(url,formData)=>{
    return fetch(`${base_url}${url}`,{
        method:"post",
        body: formData
    })
}

const sendMesssageToOpenBA=(data)=>{
    return postRequset('/openba/openba_3b/chat',data)
}

const sendRetrivealMesssageToOpenBA=(data)=>{
    return postRequset('/openba/openba_3b/retriveal',data)
}

const getRetrivealFileListAPI=()=>{
    return getRequset('/openba/file/list')
}


const deleteRetrivealFileAPI=(file_name)=>{
    return postRequset(`/openba/file/delete/${file_name}`)
}

const uploadFilesAPI=(formData)=>{
    console.log(formData)
    return uploadRequest('/openba/file/upload_files',formData)
}